<%@ page language="java" contentType="text/html; charset=ISO-8859-1" import="java.sql.*,java.util.ArrayList,org.adg.code.model.NewReportReturn;"
    pageEncoding="ISO-8859-1"%>
 <%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>   
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<base href="<%=basePath%>">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>ADG-New Report</title>
<link href="css/style.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.style2 {font-size: 52px; color: #333333; font-family: "Monotype Corsiva";}
#Layer1 {
	position:absolute;
	width:430px;
	height:29px;
	z-index:1;
	left: 196px;
	top: 94px;
}
.style4 {font-size: 22px; color: #333333; font-family: "Monotype Corsiva"; }
#Layer2 {
	position:absolute;
	width:124px;
	height:159px;
	z-index:1;
	left: 75px;
	top: 213px;
}
.style7 {font-size: 14px; color: #333333; }
.style8 {font-size: 20px}
#Layer3 {
	position:absolute;
	width:269px;
	height:32px;
	z-index:2;
	left: 4px;
	top: 126px;
}
.style9 {
	font-size: 25px;
	font-family: "Times New Roman", Times, serif;
	color: #000000;
}
#Layer4 {
	position:absolute;
	width:128px;
	height:34px;
	z-index:3;
	left: 1206px;
	top: 125px;
}
.style10 {font-size: 20px; font-family: "Times New Roman", Times, serif; color: #000000; }
#Layer5 {
	position:absolute;
	width:788px;
	height:34px;
	z-index:2;
	left: 106px;
	top: 129px;
}
#Layer6 {
	position:absolute;
	width:50%;
	height:182px;
	z-index:4;
	left: 25%;
	top: 228px;
}


body {
	font-family: Verdana, Tahoma, Arial, Helvetica, sans-serif;
	font-size: .8em;
	}
 
/* the div that holds the date picker calendar */
.dpDiv {
	}
 
 
/* the table (within the div) that holds the date picker calendar */
.dpTable {
	font-family: Tahoma, Arial, Helvetica, sans-serif;
	font-size: 12px;
	text-align: center;
	color: #505050;
	background-color: #ece9d8;
	border: 1px solid #AAAAAA;
	}
 
 
/* a table row that holds date numbers (either blank or 1-31) */
.dpTR {
	}
 
 
/* the top table row that holds the month, year, and forward/backward buttons */
.dpTitleTR {
	}
 
 
/* the second table row, that holds the names of days of the week (Mo, Tu, We, etc.) */
.dpDayTR {
	}
 
 
/* the bottom table row, that has the "This Month" and "Close" buttons */
.dpTodayButtonTR {
	}
 
 
/* a table cell that holds a date number (either blank or 1-31) */
.dpTD {
	border: 1px solid #ece9d8;
	}
 
 
/* a table cell that holds a highlighted day (usually either today's date or the current date field value) */
.dpDayHighlightTD {
	background-color: #CCCCCC;
	border: 1px solid #AAAAAA;
	}
 
 
/* the date number table cell that the mouse pointer is currently over (you can use contrasting colors to make it apparent which cell is being hovered over) */
.dpTDHover {
	background-color: #aca998;
	border: 1px solid #888888;
	cursor: pointer;
	color: red;
	}
 
 
/* the table cell that holds the name of the month and the year */
.dpTitleTD {
	}
 
 
/* a table cell that holds one of the forward/backward buttons */
.dpButtonTD {
	}
 
 
/* the table cell that holds the "This Month" or "Close" button at the bottom */
.dpTodayButtonTD {
	}
 
 
/* a table cell that holds the names of days of the week (Mo, Tu, We, etc.) */
.dpDayTD {
	background-color: #CCCCCC;
	border: 1px solid #AAAAAA;
	color: white;
	}
 
 
/* additional style information for the text that indicates the month and year */
.dpTitleText {
	font-size: 12px;
	color: gray;
	font-weight: bold;
	}
 
 
/* additional style information for the cell that holds a highlighted day (usually either today's date or the current date field value) */ 
.dpDayHighlight {
	color: 4060ff;
	font-weight: bold;
	}
 
 
/* the forward/backward buttons at the top */
.dpButton {
	font-family: Verdana, Tahoma, Arial, Helvetica, sans-serif;
	font-size: 10px;
	color: gray;
	background: #d8e8ff;
	font-weight: bold;
	padding: 0px;
	}
 
 
/* the "This Month" and "Close" buttons at the bottom */
.dpTodayButton {
	font-family: Verdana, Tahoma, Arial, Helvetica, sans-serif;
	font-size: 10px;
	color: gray;
	background: #d8e8ff;
	font-weight: bold;
	}
.style1 {color: #000000;font-size: 16px;
	font-family: Georgia, "Times New Roman", Times, serif;
}
#Layer7 {	position:absolute;
	width:581px;
	height:167px;
	z-index:5;
	left: 276px;
	top: 204px;
}
.msgstyle {color: red;font-size: 22px;
	font-family: Georgia, "Times New Roman", Times, serif;}
#msgLayer {
	position:absolute;
	text-align:center;
	width:50%;
	height:56px;
	z-index:4;
	left: 25%;
	top: 150px;
}
	
-->
</style>

<jsp:include page="../scripts/datepicker.jsp" />
</head>
<body>
<jsp:include page="head.jsp" />
<Script Language="JavaScript">
function isNumber(data, type)
{    
	var numStr=type;
	var thisChar;
	var counter=0;
	for(var i=0; i < data.length; i++)
		{
			thisChar=data.substring(i,i+1);
			if(numStr.indexOf(thisChar)!=-1)
			{counter++;}
		}
		if(counter==data.length)
		{return true;}
		else
		return false;
 }


function validate()
{
	var sel=document.getElementById("ruser");
	if(document.form1.rname.value =="")
   {
     alert("Please enter report name.");
     document.form1.rname.select();
     return false;
   }
   if(isNumber(document.form1.rname.value, "abcdefghijklmnopqrstuvwxyz  ABCDEFGHIJKLMNOPQRSTUVWXYZ")!=true)
   {
       alert("report Name field can accept alphabet only");
       document.form1.rname.select();
       return false;
   }
	if ( sel.selectedIndex == 0 ) 
	{ 
		alert ( "Please select Report User." ); 
		return false;
	} 
	var nor=document.getElementById("numoffields").value;
	
	for(var k=1;k<nor+1;k++)
	{
		var fieldname="value"+k;
		if(document.getElementById(fieldname).value=="")
			{
			alert("Values shiuld be entered for all the fields");
			return false;
			}
	}
	return true;
} 

function setcancel()
{
	document.getElementById("form2").submit();
	
}
</Script>  
<%String rn=(String)request.getAttribute("rn"); %>
<%String f=(String)request.getAttribute("f");
if(f=="1")
{%>
 <div align="center" id="msgLayer" class="msgstyle"><u><font color="red">report name already exists </font></u></div>
 <%}%>
<div id="Layer6">

  <form name="form1" method="post" action="adg.do?method=savereport" onSubmit="return validate()">
     <input type="hidden" id="rcatname" name="rcatname" value="<%=rn%>"/>
    <div align="center" class="style1">Report Catagory : <%=rn%>
     &nbsp;
     
    </div>
    
    <table width="484" border="0" align="center" cellpadding="2" cellspacing="3">
    <tr>
      <td width="225" bgcolor="#FFFFFF" class="style1"><div align="right">Report Name :</div></td>
      <td width="312" bgcolor="#FFFFFF"><div align="left">
        <input type="text" id="rname" name="rname" />*
      </div></td>
    </tr>
    <tr>
      <td bgcolor="#FFFFFF" class="style1"><div align="right">Report User :</div></td>
      <td bgcolor="#FFFFFF"><div align="left">
        <label for="select"></label>
      </div>
          <label for="select"></label>
          <div align="left">
            <select name="ruser" id="ruser">
              <option>---select---</option>
              <% 
	
		ResultSet resultSet = (ResultSet)request.getAttribute("unames");
		while(resultSet.next())
		{
			String uname=resultSet.getString(1);

%>
			<option value="<%=uname%>"><%=uname%></option>
<%
		}
	
%>
                    </select>*
        </div></td>
    </tr>
    <tr>
      <td bgcolor="#FFFFFF" class="style1"><div align="right">Reference :</div></td>
      <td bgcolor="#FFFFFF"><div align="left">
        <input type="text" id="ref" name="ref" value=""/>
      </div></td>
    </tr>
  </table>
    
    <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p>
    
   <jsp:include page="newreportinclude.jsp" />
    
    <p>&nbsp;</p>
  	
  <div align="center">
       <input type="submit" name="Submit" class="button" value="Save"/>
       <input type="button" name="Submit" class="button" value="Cancel" onClick="setcancel()"/>
  </div>
 

  
  

  <p>&nbsp;</p>
  
  </form>
</div>
<form id="form2"  name="form2" method="post" action="adg.do?method=newreport">
  </form>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><br />
</p>

 
<form id="linkform" name="linkform" method="post" action="">
 
</form>
</body>
</html>
